﻿<?xml version="1.0" encoding="utf-8"?>
<Mapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

  <Entity type="Model:Person" table="Person" discriminator="Type" discriminator-value="Model:Person">
    <Id field="PersonId">
      <Generator name="guid" />
    </Id>
    <Attribute name="Name" field="Name" db-type="String" size="50" />
    <Attribute name="FirstName" field="FirstName" db-type="String" size="50" />
  </Entity>

  <Entity type="Model:Employee" table="Person" discriminator="Type" discriminator-value="Model:Employee">
    <Id field="PersonId">
      <Generator name="guid" />
    </Id>
    <Attribute name="Salary" table="Person" field="Salary" db-type="Int32" />
  </Entity>

  <Entity type="Model:Company" table="Company">
    <Id field="CompanyId">
      <Generator name="guid" />
    </Id>
    <Attribute name="Chairman" table="Company" field="Chairman" db-type="String" size="50" />
    <Attribute name="Name" table="Company" field="Name" db-type="String" size="50" />
    
    <Reference name="Employees" entityChild="Model:Employee">
      <Rule parentField="CompanyId" childTable="Person" childField="FK_CompanyId" not-null="false" />
    </Reference>
  </Entity>
</Mapping>